package com.youdoneed.community.accounts.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.youdoneed.community.accounts.entity.Accountrecord;
import com.youdoneed.community.accounts.service.AccountRecordService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 差旅记账模块请求控制器。
 * @author shum
 * @date 2017.5.26
 */
@RestController
@RequestMapping(value = "/accountRecord" , method = {RequestMethod.GET,RequestMethod.POST})
@Api(value = "差旅记账模块请求控制器", description = "差旅记账模块的相关操作")
public class AccountRecordController {

	private static final Logger logger = LoggerFactory.getLogger(AccountRecordController.class);
	@Autowired
    AccountRecordService accountRecordService;

    @RequestMapping(value = "/save", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "后台保存差旅记账", value = "后台保存差旅记账")
    public boolean save(Accountrecord record) {
        return accountRecordService.save(record);
    }

    @RequestMapping(value = "/update", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "后台更新差旅记账", value = "后台更新差旅记账")
    public boolean update(Accountrecord record) {
        return accountRecordService.update(record);
    }

    @RequestMapping(value = "/delete", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "后台删除差旅记账记录", value = "后台删除差旅记账记录")
    public boolean delete(String id) {
        return accountRecordService.delete(id);
    }
    
    @RequestMapping(value = "/selectById", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "后台查询单条差旅记账记录", value = "后台查询单条差旅记账记录")
    public Accountrecord selectById(String id) {
        return accountRecordService.selectById(id);
    }
    
}
